import sys
from PyQt5.QtWidgets import QApplication
from ui.loginWindow import LoginWindow

"""错误日志重定向"""
import traceback


def except_hook(exc_type, exc_value, exc_tb):
    # 打印错误信息
    traceback.print_exception(exc_type, exc_value, exc_tb)
    # 也可以将错误写入日志文件
    # with open("error.log", "a") as f:
    #     traceback.print_exception(exc_type, exc_value, exc_tb, file=f)


# 重定向异常处理
sys.excepthook = except_hook


if __name__ == "__main__":
    print("项目开始启动......")

    # 启动登录界面
    qt_app = QApplication(sys.argv)
    login_window = LoginWindow()
    login_window.show()

    sys.exit(qt_app.exec_())